package company.meituan;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * 美团笔试第二题
 *
 * @author briarbear
 * @blog https://briarbear.github.io
 * @date 2018-09-07 10:58
 */
public class M5 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            int n = scanner.nextInt();
            int k = scanner.nextInt();
            int t = scanner.nextInt();
            int[] array = new int[n];
            for (int i = 0; i < n; i++) {
                array[i] = scanner.nextInt();
            }

            HashMap<Integer, Integer> map = new HashMap<>();
            int left = 0, right = left + k - 1;
            for (int i = 0; i <= right; i++) {
                if (map.containsKey(array[i])) {
                    int temp = map.get(array[i]);
                    map.put(array[i], temp + 1);
                } else
                    map.put(array[i], 1);
            }
            int res = 0;
            while (right < n-1) {
                if (helper(map, t)) res++;
                map.put(array[left], map.get(array[left]) - 1);
                if (map.containsKey(array[right + 1])) {
                    map.put(array[right + 1], map.get(array[right + 1]) + 1);
                } else
                    map.put(array[right + 1], 1);
                left++;
                right++;
            }
            if (helper(map, t)) res++;
            System.out.println(res);
        }
    }

    public static boolean helper(HashMap<Integer, Integer> map, int t) {
        for (Integer value : map.values()) {
            if (value >= t) return true;
        }
        return false;
    }


}
